package com.cn.wanxi.servlet;

import com.cn.wanxi.model.CompanyModel;
import com.cn.wanxi.model.NavModel;
import com.cn.wanxi.service.CompanyService;
import com.cn.wanxi.service.NavService;
import com.cn.wanxi.service.impl.CompanyServiceImpl;
import com.cn.wanxi.service.impl.NavServiceImpl;

import javax.servlet.http.HttpServletRequest;

/**
 * static 另一个作用，就是在内存里面只加载一次，且不可被垃圾回收去回收
 * 修饰符的应用:默认不写只能在包里面使用
 */
class TopFootServlet {

    static void getData(HttpServletRequest req) {
//        CompanyService companyService = new CompanyService();
//        CompanyModel companyModel = companyService.getCompanyModel();
        CompanyService companyService=new CompanyServiceImpl();
        CompanyModel companyModel=companyService.getCompanyModel();
        req.setAttribute("companyModel", companyModel);


        NavService navService = new NavServiceImpl();

        NavModel[] navModels = navService.getNavModels();
        req.setAttribute("navModels", navModels);
    }

}
